USE [UltimusBusiness]
GO

/****** Object:  View [dbo].[V_ULT_DEPARTMENT]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Alter View [dbo].[V_ULT_DEPARTMENT] as
select ID as DEPARTMENTID ,
  NAME as DEPARTMENTNAME,
  PARENTDEPT as PARENTID
 FROM UltimusOrgChart..DEPARTMENTS  a with(nolock) 
 
GO

/****** Object:  View [dbo].[V_ULT_EMPDEPARTMENTS]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


Alter View [dbo].[V_ULT_EMPDEPARTMENTS] as
select ID as EMPLOYEEID ,
  DEPTID as DEPARTMENTID,
	 JOBFUNCTION 
 FROM UltimusOrgChart..JOBS  with(nolock)


GO

/****** Object:  View [dbo].[V_ULT_EMPLOYEE]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Alter View [dbo].[V_ULT_EMPLOYEE] as
select ID as EMPLOYEEID ,a.FULLNAME as FIRSTNAME,' ' as LASTNAME,a.NAME as SHORTNAME,
JOBFUNCTION as TITLE, '' as EMAIL,
  SUPERVISORID as SUPERVISORID,DEPTID as DEPARTMENTID
 FROM UltimusOrgChart..JOBS a with(nolock) 
inner join UltimusOrgChart..MEMBERS b with(nolock) on a.NAME=b.NAME

GO

/****** Object:  View [dbo].[V_ULT_INCIDENTS]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Alter View [dbo].[V_ULT_INCIDENTS]
as
SELECT     PROCESSNAME, PROCESSVERSION, INCIDENT, PRIORITY, SUMMARY, STARTTIME, ENDTIME, STATUS, INITIATOR, '' as PARENTTASKID, TIMELIMIT, 
                      HELPURL, MAINSS
FROM         UltimusEngDB..INCIDENTS with(nolock)

GO

/****** Object:  View [dbo].[V_ULT_PROCESSSTEPS]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Alter View [dbo].[V_ULT_PROCESSSTEPS]
as
SELECT     *
FROM         UltimusEngDB..PROCESSSTEPS with(nolock)

GO

/****** Object:  View [dbo].[V_ULT_TASKS]    Script Date: 2013/8/30 16:57:33 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Alter View [dbo].[V_ULT_TASKS]
as
SELECT     TASKID, PROCESSNAME, PROCESSVERSION, INCIDENT, STEPID, STEPLABEL, RECIPIENT, RECIPIENTTYPE, TASKUSER, ASSIGNEDTOUSER, 
                      STATUS, SUBSTATUS, STARTTIME, ENDTIME, QSTARTTIME, QENDTIME, DELAYTIME, OVERDUETIME, URGENTDUETIME, TASKRATE, TASKTIME, 
                      COST, HELPURL, '' as NOTES, REFERER, LOCALSS
FROM         UltimusEngDB..TASKS with(nolock)

GO


